﻿@model SchoolCommunicationSystem.Models.ClassAndSchoolModels

@{
    ViewBag.Title = "Tạo lớp mới";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.datepicker-vi-VN.js")" type="text/javascript"></script>
<script>
$(function () {
    $.validator.addMethod('date',
    function (value, element) {
        if (this.optional(element)) {
            return true;
        }
        var ok = true;
        try {
            $.datepicker.parseDate('dd/mm/yy', value);
        }
        catch (err) {
            ok = false;
        }
        return ok;
    });
    $(".datefield").datepicker({ dateFormat: 'dd/mm/yy', yearRange: '1950:2020', changeYear: true, changeMonth: true });
});
</script>
<div id="page-heading">
    <h1>Quản lý lớp học</h1>
</div>
<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Tạo lớp học</h4>
                </div>
                <div class="panel-body">
                    <h3>Thông tin lớp học</h3>
                    @using (Html.BeginForm("AddClass", "Class", FormMethod.Post, new { @class = "form-horizontal" }))
                    {
                        @Html.ValidationSummary(true)
                        <div class="form-group">
                            @Html.Label("Tên lớp học", new { @class = "col-sm-3 control-label" })
                            <div class="col-sm-6">
                                @Html.EditorFor(model => model._className)
                            </div>
                            <div class="col-sm-3">
                                @Html.ValidationMessageFor(model => model._className)
                            </div>
                        </div>  <div class="form-group">
                            @Html.Label("Ngày bắt đầu", new { @class = "col-sm-3 control-label" })
                            <div class="col-sm-6">
                                @Html.EditorFor(model => model._startDate)
                            </div>
                            <div class="col-sm-3">
                                @Html.ValidationMessageFor(model => model._startDate)
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Năm học", new { @class = "col-sm-3 control-label" })

                            <div class="col-sm-6">
                                @Html.DropDownListFor(model => model._schoolYearID, Model.SchoolYearSelectList, "[Hãy chọn năm học]", new { @class = "form-control" })
                            </div>
                            <div class="col-sm-3">
                                @Html.ValidationMessageFor(model => model._schoolYearID)
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.Label("Giáo viên chủ nhiệm", new { @class = "col-sm-3 control-label" })
                            <div class="col-sm-6">
                                @Html.DropDownListFor(model => model._teacherID, Model.TeacherSelectList, "[Hãy chọn giáo viên]",new { @class = "form-control" })
                            </div>
                            <div class="col-sm-3">
                                @Html.ValidationMessageFor(model => model._teacherID)
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 col-sm-offset-3">
                                <div class="btn-toolbar">
                                    <button class="btn-primary btn" type="submit">Tạo</button>
                                </div>
                            </div>
                        </div>
                    }

                </div>
            </div>
        </div>
    </div>
</div>

